package aad.storyboard.controller;

import java.util.Observable;
import java.util.Observer;



public class StoryTimer extends Observable implements Observer, Runnable{
	
    private int currentTime = 0;
    private long currentSystemTime=0;
    private boolean playing;
    
    private static StoryTimer inst = new StoryTimer ();

	private StoryTimer(){}
	
	public static StoryTimer getInstance(){
		return inst;
	}    
    
    public int getCurrentTime() {
        return currentTime;
    }//getCurrentTime
    
    	
    @Override
	public void update(Observable arg0, Object arg1) {
		currentTime=((AudioPlayer)arg0).getCurrentPosition();
		currentSystemTime=System.currentTimeMillis();
		setChanged();
		notifyObservers();
		//System.out.println("Timer has been notified about current time: "+ currentTime);
		
	}

	@Override
	public void run() {
		new Thread(this).start();
		
	}
}

